package com.hitown.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hitown.model.Tdictionary;
import com.hitown.service.TdictionaryService;
import com.hitown.util.*;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 字典表 前端控制器
 * </p>
 *
 * @author menu
 * @since 2021-07-19
 */
@RestController
@RequestMapping("/t-dictionary")
public class TdictionaryController {

    @Autowired
    private TdictionaryService tdictionaryService;


    @ApiOperation(value = "查询")
    @RequestMapping("selectList")
    public R selectPage(@RequestParam(value ="type", required = false)  String type,@RequestParam(value = "id", required = false)  String id){
        QueryWrapper<Tdictionary> wrapper =new QueryWrapper<>();
        if(!StringUtils.isEmpty(type)) {
            wrapper.eq("TYPE",type);

        }
        if(!StringUtils.isEmpty(id)) {
            wrapper.eq("ID",id);

        }
        List<Tdictionary> list =tdictionaryService.list(wrapper);
        return R.ok().put("data",list);

    }





}

